#!/usr/bin/env python3
# coding:utf-8
#lanxing

#判断代码，判断是否安装requests库
try:
    import requests
except:
    print(u"返回桌面,Shift+鼠标右键,在此处打开命令窗口(W),输入:pip install requests")
import zlib
import json


def whatweb(url):
    response = requests.get(url, verify=False)
    # 上面的代码可以随意发挥,只要获取到response即可
    # 下面的代码您无需改变，直接使用即可
    whatweb_dict = {"url": response.url, "text": response.text, "headers": dict(response.headers)}
    whatweb_dict = json.dumps(whatweb_dict)
    whatweb_dict = whatweb_dict.encode()
    whatweb_dict = zlib.compress(whatweb_dict)
    data = {"info": whatweb_dict}
    ret = requests.post("http://whatweb.bugscaner.com/api.go", files=data).json()
    key_value = list(ret.keys())
    print('字典中的key转换为列表：', key_value)

    # 字典中的value转换为列表
    value_list = list(ret.values())
    print('字典中的value转换为列表：', value_list)

    l = []
    for i in value_list:
        for j in i:
            l.append(j)
    print(l)
    print(key_value)
    zip_data = zip(key_value,l)
    return zip_data



# http://www.sh-bokecc.cn/
# http://www.dedecms.com/
# http://www.mapintime.com/
# https://www.siteserver.cn/
# http://www.jnbec.com/
# https://www.joyboom.com/shouye/